package stdlib.util

import kotlinx.coroutines.*
import java.time.LocalTime
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit


fun main() {
    println("hello world start ${LocalTime.now().second}")
    val countDownLatch = CountDownLatch(10)
    CoroutineScope(Dispatchers.IO).launch {
        while (isActive) {
            println("countDownLatch.count,${LocalTime.now().second}")
            countDownLatch.countDown()
            delay(timeMillis = 500)
        }
    }
    countDownLatch.await(5, TimeUnit.SECONDS)
    println("hello world end ${LocalTime.now().second}")
}